package com.xvyy.tingshu.estest.entity;


import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * ClassName: Person
 * Package: com.xvyy.tingshu.estest.entity
 *
 * @Description:
 * @Author: xvyy
 * @Create: 2025/1/17 - 19:53
 * @Version: v1.0
 */
@Document(indexName = "person")   // 索引库的名字person
@Data
public class Person {


    // 文档的id
    @Id
    private Long id;
    // 文档的name(java中的string在es中有两种类型 keyword和text)
    @Field(value = "name", type = FieldType.Text, index = true, analyzer = "ik_max_word")
    private String name;
    @Field(value = "address", type = FieldType.Keyword, index = false)
    private String address;

    @Field(value = "age", type = FieldType.Integer, index = true)
    private Integer age;
}
